<html lang="en">
	<head>
		<link
			rel="stylesheet"
			href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"
		/>
	</head>
	<body style="padding: 20px; font-family: sans-serif">
		<script src="../../src/lib/core.js"></script>
		<script src="../../src/lib/web.js"></script>
		<script src="../../src/lib/plugin/socket.js"></script>

		<em>Web Socket Playground</em>
		<hr />
		<style>
			button {
				padding: 12px;
				margin: 12px;
			}
		</style>
		<script type="text/hyperscript">
			socket MySocket ws://localhost:5150
			  on message as json
			    log message
			end
		</script>

		<div>
			<button _="on click put MySocket.rpc.echo('foo') into my.innerHTML">
				Echo Socket...
			</button>

			<button
				_="on click set name to MySocket.rpc.ask('What is your name? ')
                    put 'Nice to meet you, $name' into my.innerText"
			>
				What's your name?
			</button>

			<button _="on click put MySocket.rpc.throw('Nice...') into my.innerHTML">
				Throw Error
			</button>
		</div>

		<div>
			<button _="on click send foo(bar:'doh', rey:42) to MySocket">
				Echo Socket...
			</button>
		</div>
	</body>
</html>
